/**
 *  文件名:Global.java
 *  修改人:lihangjie
 *  创建时间:2015-9-7 下午3:26:09
 */
package com.sharemob.tinchat.lib.common;

import java.util.UUID;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Environment;
import android.os.Handler;

/**
 * 
 * <一句话功能简述>
 *
 * @author lihangjie
 * version [版本号,2015-9-7 下午3:26:09]
 * @see    [相关类/方法]
 * @since  [产品/模块版本]
 *
 */
public class SMGlobal {

	private static SMGlobal instance=null;
	public Context context;
	public Handler handler;
	private SMGlobal(){}
	public static SMGlobal getInstance(){
		if(instance==null){
			instance=new SMGlobal();
		}
		return instance;
	}
	
	public static String getIconPath(String filename){
		 String headIconPath=String.format("%s/%s/%s", Environment.getExternalStorageDirectory(),"TinChat",filename);
		 return headIconPath;
	}
	
	public String getUUID(){
		UUID uuid = UUID.randomUUID();
        return uuid.toString().replace("-", "");
	}
	
	public Drawable getDrawableByResID(int resid){
		Drawable drawable= SMGlobal.getInstance().context.getResources().getDrawable(resid);
		drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());  
		return drawable;
	}
	
	
	private final static int[] dayArr = new int[] { 20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22 };  
	private final static String[] constellationArr = new String[] { "摩羯座♑️", "水瓶座♒️", "双鱼座♓️", "白羊座♈️", "金牛座♉️", "双子座♊️", "巨蟹座♋️", "狮子座♌️", "处女座♍️", "天秤座♎️", "天蝎座♏️", "射手座♐️", "摩羯座♑️" };  
	public static String getConstellation(int month, int day) {  
	    return day < dayArr[month - 1] ? constellationArr[month - 1] : constellationArr[month];  
	}  
	
}
